package com.example.my_music_palyer.mapper;

import com.example.my_music_palyer.model.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Service;

@Mapper
public interface ImageMapper {

    @Insert("insert into image(userid,username,url,flag) values (#{id},#{username},#{url},#{flag});")
    int uploadImage(int id, String username, @Param("url") String url, @Param("flag") int flag);

    @Update("update image set flag = #{flag} where userid = #{id} and flag = 1 and url=#{url}")
    int updateImage(int id, @Param("flag") int flagm, @Param("url") String url);

    @Select("select url from image where userid = #{id} and flag = 1")
    String getUseImageUrl(int id);
}
